@echo off

:: 设置版本号
set VERSION=1.0.0

:: 创建输出目录
if not exist dist mkdir dist
if not exist dist\config mkdir dist\config
if not exist dist\logs mkdir dist\logs

:: 设置编译参数
set LDFLAGS=-X main.Version=%VERSION%

:: 编译 Windows 版本
echo Building for Windows...
set GOOS=windows
set GOARCH=amd64
go build -ldflags "%LDFLAGS%" -o dist/cross-pay-go_windows_amd64.exe ./src/main.go

:: 编译 Linux 版本
echo Building for Linux...
set GOOS=linux
set GOARCH=amd64
go build -ldflags "%LDFLAGS%" -o dist/cross-pay-go_linux_amd64 ./src/main.go

:: 编译 MacOS 版本
echo Building for MacOS...
set GOOS=darwin
set GOARCH=amd64
go build -ldflags "%LDFLAGS%" -o dist/cross-pay-go_darwin_amd64 ./src/main.go

:: 复制配置文件
echo Copying configuration files...
copy config\config.yaml dist\config\
copy config\config.prod.yaml dist\config\

echo Build completed. Binaries and configuration files are located in the dist directory. 